﻿@using PagedList.Mvc
@using WEBBANGDIA.Models
@model PagedList.IPagedList<WEBBANGDIA.Models.BangDia>

@{
    ViewBag.Title = "Danh sách băng đĩa";
}

<h2>Danh sách sản phẩm</h2>
<style type="text/css">
    .a {
        color: #0000ff;
    }
    .a:hover{color: #000080}
</style>
<p>
    @Html.ActionLink("Create New", "Create", new{@class="a"})
</p>
@using (Html.BeginForm("Index", "QTBangDia", FormMethod.Get))
{
    <div class="col-sm-offset-3">
        Tìm  @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)
        <input type="submit" value="Tìm kiếm" />
    </div>
    <br />
    <table>
        <tr>
            <th>@Html.ActionLink("Tên băng đĩa", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("Loại đĩa", "Index", new { sortOrder = ViewBag.TypedickSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("HSX", "Index", new { sortOrder = ViewBag.HSXSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("Giá", "Index", new { sortOrder = ViewBag.PriceSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("Xem", "Index", new { sortOrder = ViewBag.ViewSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("Bán", "Index", new { sortOrder = ViewBag.BuySortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th>@Html.ActionLink("Thuê", "Index", new { sortOrder = ViewBag.ThueSortParm, currentFilter = ViewBag.CurrentFilter }, new { @class = "a" })</th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.TenBD)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LoaiDia.TenLoai)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.HangSanXuat.TenHSX)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Gia)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LuotView)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LuotBan)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LuotThue)
                </td>
                <td style="background: #e2e2e2">
                    @Html.ActionLink("Edit", "Edit", new { id = item.MaBD }) |
                    @Html.ActionLink("Details", "Details", new { id = item.MaBD }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.MaBD })
                </td>
            </tr>
        }

    </table>
    <div class="col-sm-offset-6">
        Trang: @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) / @Model.PageCount

        @Html.PagedListPager(Model, trang => Url.Action("Index",
                new { trang, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))
    </div>
}
